package org.oos.logging;

import java.util.logging.ConsoleHandler;
import java.util.logging.Logger;

/**
 * Allows to attach a Console and, if no name is given to the {@link Logger} it
 * will provide the name of the refering class
 * 
 * @author pablo.gonzalez@11870.com
 * 
 */
public class ConsoleLogger extends Logger {

	public ConsoleLogger(String name, String resourceBundleName) {
		super(name, resourceBundleName);
	}

	public ConsoleLogger(String name) {
		super(name, null);
	}

	public ConsoleLogger() {
		this(referingClass());
		addHandler(new ConsoleHandler());
	}

	private static String referingClass() {
		return Thread.currentThread().getStackTrace()[2].getClassName();
	}

}
